<?php /*a:3:{s:60:"F:\PHPproject\phpzhengshiban\app\index\view\member.edit.html";i:1594315456;s:36:"../app/index/view/public.header.html";i:1594302724;s:36:"../app/index/view/public.footer.html";i:1594302724;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Admin</title>
    <script type="text/javascript" src="/plug/layui/layui.js"></script>
    <script type="text/javascript" src="/static/script/common.js"></script>
    <script type="text/javascript" src="/static/script/moment.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/plug/awesome/css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="/plug/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/common.css" />
</head>
<body>

        <form class="layui-form layui-form-pane" style="padding: 16px">
            <div class="layui-form-item">
                    <label class="layui-form-label" for="mobile">手机号码</label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="mobile" id="mobile" type="text" placeholder="请输入手机号码" value="<?php echo htmlentities($data['member_mobile']); ?>" autocomplete="off" lay-verify="required"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" for="name">姓名</label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="name" id="name" type="text" placeholder="请输入姓名" value="<?php echo htmlentities($data['member_name']); ?>" autocomplete="off" lay-verify="required"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" for="age">年龄</label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="age" id="age" type="text" placeholder="请输入年龄" value="<?php echo htmlentities($data['member_age']); ?>" autocomplete="off" lay-verify="required"/>
                    </div>
                </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="test1">头像</label>
                <div class="layui-upload">
                    <button type="button" class="layui-btn" id="test1">上传图片</button>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="demo1">图片预览</label>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="demo1" style="width: 160px;height: 160px">
                    <p id="demoText"></p>
                </div>
            </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" type="submit"  lay-filter="submit" lay-submit>立即提交</button>
                        <button class="layui-btn" type="reset">重置</button>
                    </div>
                </div>
        </form>
<script type="text/javascript">
    layui.use(["layer", "form", "table", "upload", "element", "laydate"], function () {

        let fileName = '';

        let uploadInst = layui.upload.render({
                elem: '#test1'
                , url: 'http://127.0.0.1/index.php/index/member/upload/' //改成您自己的上传接口
                , before: function (obj) {
                    //预读本地文件示例，不支持ie8
                    obj.preview(function (index, file, result) {
                        layui.jquery('#demo1').attr('src', result); //图片链接（base64）
                    });
                }
                , done: function (res) {
                    fileName = res.data;
                }
                , error: function (res) {
                    showMessage('上传失败');
                }
        });

        layui.form.on('submit(submit)',function (data) {
            postNormal(location.href,{
                mobile:data.field.mobile,
                name:data.field.name,
                age:data.field.age,
                filename: fileName
            },
                function (result) {
                closeAll();
                if(result.code!=='1'){
                    showMessage(result.msg);
                    return;
                }
                showMessage("修改成功~");
            })
             return false;
        });
    });
</script>
</body>
</html>

